<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 作业 [524,633,777,82,99,422,7778,20,6,44,523] // 大于300 统计求和

      let arr = [524, 633, 777, 82, 99, 422, 7778, 20, 6, 44, 523]

      let newArr = []
      for (let i = 0; i < arr.length; i++) {
        arr[i] > 300 && newArr.push(arr[i])
      }
      console.log(newArr)
      let res =  newArr.reduce(function(prev,item){
         return prev+item
         },0)
         console.log(res)
    </script>
  </body>
</html>
